﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ctlTaskEditor.ascx.cs" Inherits="Ctl_ctlTaskEditor" %>


<%@ Register src="ctlEmployeeTree.ascx" tagname="ctlEmployeeTree" tagprefix="uc2" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register src="ctlTaskHistory.ascx" tagname="ctlTaskHistory" tagprefix="uc3" %>
<%@ Register src="ctlEmpCombo.ascx" tagname="ctlEmpCombo" tagprefix="uc4" %>
<%@ Register   Namespace="Grishko.UI"    TagPrefix="uc2" %>
<%@ Register src="~/Ctl/ctlClientListSelector.ascx" tagname="ctlClientListSelector" tagprefix="uc5" %>

<style type="text/css">        
        .chTree_Categoria{}              
</style> 

<table width ="100%" cellpadding ="2px" cellspacing ="0">            
                <tr >
                    <td   style ="width :50px" >                            
                    <asp:ImageButton ID="BntCancelTask" OnClick ="BntCancelTask_Click"  runat="server" 
                       ImageUrl="~/images/grd_minus.gif"  />
                    </td>                          
                    <td  style ="width :25%" >                
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="*" ControlToValidate ="txtContent"></asp:RequiredFieldValidator>
                    </td>                    
                    <td   style="text-align: right" >
                <asp:CheckBox ID="chTaskClosed" runat="server"  Checked =<%# grdTask.Task.IsClosed %> Text="Задача закрыта" />                
            </td>
            
            </tr>
            
                <tr >
            <td style="text-align :right;vertical-align :top"  >                            
                    <asp:Image ID="imgTextHistory" runat="server"  ToolTip =<%# grdTask.HistoryofMessage %>
                        ImageUrl="~/images/edit_text.gif" />
                    </td>                          
            <td colspan="2" >                                
                <asp:TextBox ID="txtContent" runat="server" CssClass="TextBox"  
                    Text =<%# grdTask.Task.TaskContent %>
                    TextMode="MultiLine" Height ="82px" Width="99%"/>                    
                    </td>
            
            </tr>                
                
                <tr >
            <td   style ="width :15px" >                            
                   &nbsp;</td>                          
            <td  style ="width :25%"  class ="grd_td_item" >                
                Категория :</td>
            <td  class ="grd_td_item" style ="text-align :left "  >
              <table width ="100%" cellpadding ="0" cellspacing ="0" >
                <asp:ListView ID="lvTaskCategory" runat="server" onitemcommand="ItemCommand" 
                    onitemediting="ItemEditing" onitemupdating="lvEmpl_ItemUpdating">
                 <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >                    
                        <tr >
                        <td style ="height:20px" >
                               <%# ((string)Eval("s_Type")==string.Empty ? "н/д":(string)Eval("s_Type"))%> 
                        </td>
                        <td style ="width :25px; text-align :right "  >
                            <asp:ImageButton ID=ImageButton1 Visible =<%# EditEmplEnabled() %>   CommandName ="Edit" ImageUrl ="~/images/icon-edit.gif" runat="server" />
                        </td>
                        </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                        <td >
                        
                            
                         <div >
                        <table width ="100%" >
                        <tr >                            
                            <td style ="vertical-align :top" >                            
                                <uc2:TreeDictionaryControl_Rb  ID ="tv_TaskCategory" runat ="server" EnableViewState="False" 
                                TreeIsCollapse="True" CollapseCssDown="CollapseCssDown" CollapseCssUp="CollapseCssUp"    
                                 SelectedMode="RbSelect"  >
                            </uc2:TreeDictionaryControl_Rb >                                     
                            </td>                            
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="btnUpdCurator" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />                            
                            </td>
                        </tr>
                         </table>  
                         </div>
                        </td>                        
                </tr>
                </EditItemTemplate>                
                </asp:ListView>
                </table >
           </td>
            
            </tr>
            
                <tr >
            <td   style ="width :15px" >                            
                   &nbsp;</td>                          
            <td  style ="width :25%" class ="grd_td_item" >                
                Окончание:</td>
            <td  class ="grd_td_item" >
                <table width ="100%" cellpadding ="0" cellspacing ="0" >
                <asp:ListView ID="lvDtFinish" runat="server" onitemcommand="ItemCommand" 
                    onitemediting="ItemEditing" onitemupdating="lvEmpl_ItemUpdating">
                 <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >                    
                        <tr >
                        <td style ="height:20px" >
                               <%# grdTask.Task.dtFinish.ToString("D") + "  "+ grdTask.FinishTime.ToString()+":00"%> 
                        </td>
                        <td style ="width :25px; text-align :right "  >
                            <asp:ImageButton ID=ImageButton1 Visible =<%# EditEmplEnabled() %>   CommandName ="Edit" ImageUrl ="~/images/icon-edit.gif" runat="server" />
                        </td>
                        </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                        <td >
                         <div >
                          <table style="width:100%;" cellpadding ="0" cellspacing ="0">
                                <tr>
                                    <td style ="width:80px " >
                                        <asp:TextBox ID="txtDtStart" Text =<%# Eval("s_dtFinish") %> CssClass ="TextBox" runat="server"></asp:TextBox>
                                        <cc1:CalendarExtender ID="TextBox1_CalendarExtender" Format="dd.MM.yyyy"  runat="server" 
                                        Enabled="True" TargetControlID="txtDtStart">
                                        </cc1:CalendarExtender>                                        
                                    </td>
                                    <td style ="width :80px; text-align :right" >
                                        Время:</td>
                                    <td style ="vertical-align:top;text-align :left  ">                                    
                                        <asp:DropDownList ID="cmbTime" runat="server">                              
                                        </asp:DropDownList>
                                    </td>
                                    <td style ="vertical-align:top">
                                        &nbsp;</td>
                                        
                                <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="btnUpdCurator" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />                            
                                </td>
                                        
                                </tr>
                            </table>
                         </div>   
                        </td>                        
                </tr>
                </EditItemTemplate>                
                </asp:ListView>
                </table >    
                
            </td>
            
            </tr>
                          
                <tr >
            <td   style ="width :15px" >                            
                   <asp:HiddenField ID="hfFaceID" runat="server" />
                    
                    </td>                          
            <td  style ="width :25%" class ="grd_td_item" >                
                Исполнитель :</td>
            <td  class ="grd_td_item"  >
                <table width ="100%" cellpadding ="0" cellspacing ="0" >
                <asp:ListView ID="lvEmpl" runat="server" onitemcommand="ItemCommand" 
                    onitemediting="ItemEditing" onitemupdating="lvEmpl_ItemUpdating">
                 <LayoutTemplate>
                       <tr runat="server" id="itemPlaceholder" >
                       </tr>                            
                </LayoutTemplate>
                <ItemTemplate >                    
                        <tr >
                        <td style ="height:20px" >
                               <%# (grdTask.s_Employeer == string.Empty ? "н/д" : grdTask.s_EmployeerWithPosition)%>
                        </td>
                        <td style ="width :25px; text-align :right "  >
                            <asp:ImageButton ID=ImageButton1 Visible =<%# EditEmplEnabled() %>   CommandName ="Edit" ImageUrl ="~/images/icon-edit.gif" runat="server" />
                        </td>
                        </tr>
                </ItemTemplate>
                <EditItemTemplate >
                <tr >
                        <td >                         
                        <table width ="100%" cellpadding ="0" cellspacing ="0" >
                        <tr >                            
                            <td style ="vertical-align :top" >                                                                                            
                                        <uc4:ctlEmpCombo CurrentValue=<%# grdTask.Task.EmplID  %> ID="ctlEmpCombo1" Widtch ="500px" runat="server" />                                
                            </td>                            
                              <td style ="text-align :right; vertical-align :top ;width :25px" >
                                    <asp:ImageButton CommandName ="Update" ID="btnUpdCurator" runat="server" 
                                        ImageUrl="~/images/icon-save.gif" />                            
                            </td>
                        </tr>
                         </table>                           
                        </td>                        
                </tr>
                </EditItemTemplate>                
                </asp:ListView>
                </table >
                    </td>
            
            </tr>                          
                
                <tr >
            <td   style ="width :15px" >                            
                   &nbsp;</td>                          
            <td  style ="width :25%" class ="grd_td_item" >                
                Клиент :</td>
            <td  class ="grd_td_item" style ="text-align :left " >
                
                <table width ="100%" cellpadding ="0" cellspacing ="0" >
                    <tr >
                        <td style ="text-align :left " >
                        <table style="width :100%" cellpadding ="0" cellspacing ="0" >
                        
                        <asp:ListView ID="lvClient" runat="server" onitemcommand="ItemCommand" onitemediting="lvClient_ItemEditing" onitemupdated="lvClient_ItemUpdated"                           onitemupdating="ItemUpdating">
                            <LayoutTemplate>
                                <tr runat="server" id="itemPlaceholder" >
                                </tr>                            
                                </LayoutTemplate>
                            <ItemTemplate >                    
                        <tr >                      
                         <td>
                             <%# (grdTask.s_Client==string.Empty?"н/д":grdTask.s_Client)   %>
                        </td>   
                        <td style ="width :25px; text-align :right "  >
                            <asp:ImageButton ID=ImageButton1  ImageUrl ="~/images/icon-edit.gif" CommandName ="Edit" runat="server" />
                        </td>
                        </tr>
                </ItemTemplate>
                            <EditItemTemplate >
                <tr >
                        <td style ="text-align :left; vertical-align :top ">
                              <uc5:ctlClientListSelector ID="ctlClientListSelector1" runat="server" />                                                          
                        </td>
                </tr>
                </EditItemTemplate>                
                        </asp:ListView>
                        </table>
                        </td>
                    </tr>
                </table>
                
            </td>
            
            </tr>                
                
                <tr >
            <td   style ="width :15px" >                            
                   &nbsp;</td>                          
            <td  colspan="2" >                
            <table width ="100%" cellpadding ="0" cellspacing ="0" >
                    <asp:ListView ID="lvHistory" runat="server" onitemcommand="ItemCommand" 
                        onitemediting="ItemEditing" onitemupdating="lvEmpl_ItemUpdating">
                    <LayoutTemplate>
                    <tr runat="server" id="itemPlaceholder" >
                    </tr>                            
                    </LayoutTemplate>
                    <ItemTemplate >
                        <tr >                        
                        <td  style ="text-align:left" >                
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName ="Edit" Font-Bold ="true" Font-Size="X-Small">Показать историю</asp:LinkButton>
                        </td>                                                     
                        </tr>
                    </ItemTemplate>
                    <EditItemTemplate >
                       <tr >                        
                        <td  style ="text-align:left" >                
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName ="Update" Font-Bold ="true" Font-Size="X-Small">Скрыть историю</asp:LinkButton>
                        </td>                                                     
                       </tr>
                       <tr >                        
                        <td  style ="text-align:left" >                
                            <table style="width:100%;" cellpadding ="0" cellspacing ="0">
                                <tr>                                                                
                                 <td width="30%" class ="grd_td_head"> Дата изменения</td>
                                 <td class ="grd_td_head"> Автор</td>
                                 <td width="30%" class ="grd_td_head" >Категория/Статус</td>                               
                                </tr>
                                
                                
                                <asp:ListView ID="lvHistoryItems" runat="server" onitemcommand="ItemCommand" 
                                    onitemediting="ItemEditing" onitemupdating="lvEmpl_ItemUpdating">
                                <LayoutTemplate>
                                <tr runat="server" id="itemPlaceholder" >
                                </tr>                            
                                </LayoutTemplate>
                                 <ItemTemplate >                                 
                                    <tr>
                                 <td width="30%">
                                       <asp:Image ID="imgTextHistory1" runat="server"   ToolTip = <%# GetHistoryItemAsText((AgencyEntityLib.BaseEntity.grdTaskHistoryitem)Container.DataItem)%> ImageUrl="~/images/edit_text.gif" />                                     
                                       <%# ((DateTime)Eval("Date")).ToString("dd MMMM") +" "+ ((DateTime)Eval("Date")).ToString("t")%></td>
                                <td>
                                       <%# ((String)Eval("Creator.ShortName"))%>  </td>
                                <td width="30%">
                                    <%#  ((String)Eval("s_Type"))%>  </td>
                                </tr>                                
                                 </ItemTemplate>   
                                </asp:ListView> 
                                
        <tr>
        <td width="30%">
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td width="30%">
            &nbsp;</td>
    </tr>
</table>
                        </td>                                                     
                       </tr>
                       
                       
                    </EditItemTemplate>
                    </asp:ListView> 
            </table>
 
            </td>
            
            </tr>                
                
 </table>
 
 
 
 
 
<table width ="100%" cellpadding ="2px" cellspacing ="0">            
       <tr >
            <td class ="grd_td_head">                            
                   &nbsp;</td>                          
            <td class ="grd_td_head" style ="width :25%" >                
                &nbsp;</td>
            <td   class ="grd_td_head" style ="text-align :right " >
                
                <asp:Button ID="btnSaveTask" runat="server" CssClass="btn_wizard" 
                    OnClick="btnSaveTask_Click" Text="Сохранить" />
                    </td>
            
            </tr>
</table> 
<asp:HiddenField ID="hfCurrentTask" runat="server" />
<asp:HiddenField ID="hf_TaskCategory" runat="server" />














































